<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			/* let ls = localStorage;
			ls.setItem("id", 666);
			ls.name = "老王";
			ls["pwd"] = 123456;
			let ss = sessionStorage;
			ss.setItem("id", 666);
			ss.name = "老王";
			ss["pwd"] = 123456;


			console.log(ls.getItem("id"));
			console.log(ls.name);
			console.log(ls["pwd"]);
 */

			/* let ls = localStorage;
			ls.setItem("id", 666);
			ls.name = "老王";
			ls["pwd"] = 123456;
			let ss = sessionStorage;
			ss.setItem("id", 666);
			ss.name = "老王";
			ss["pwd"] = 123456;
			for (let i = 0; i < ls.length; i++) {
				console.log(ls.key(i));
			} */

			let ls = localStorage;
			ls.setItem("id", 666);
			ls.name = "老王";
			ls["pwd"] = 123456;
			let ss = sessionStorage;
			ss.setItem("id", 666);
			ss.name = "老王";
			ss["pwd"] = 123456;

			ls.clear(); //全部删除
			ls.removeItem("name"); //根据key值删除
		</script>
	</head>
	<body>

	</body>
</html>
